﻿@model WorkTimePrj.Models.Item
@{
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <title>编辑工时记录</title>
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
    <link href="@Url.Content("~/Content/themes/base/jquery.ui.all.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
    <style type="text/css">
        .field-validation-error { float: none; }
        .body ul.cur li { /*height:30px; line-height:30px;*/ padding: 10px; width: 100%; display: block; float: left; }
        .editor-label { width: 90px; float: left; }
        .editor-field { float: left; }
        .Button01 { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; color: #003677; height: 20px; border: solid 1px #5381B3; padding-left: 4px; padding-right: 4px; background: #ffffff; }
        /*.editor-label{color:#002157;}*/
        .body ul.cur li.LI01 { display: none; }
    </style>
</head>
<body>
    <script src="@Url.Content("~/Scripts/jquery-1.7.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/DatePicker/WdatePicker.js")" type="text/javascript"></script>
    <script type="text/javascript">
          $(function () {
               if (@ViewBag.close==1)
               {
                    var settngs = $.data($('form')[0], 'validator').settings;
                    $('#rate').addClass('non_val');
                    $('#comment').addClass('non_val');
                    settngs.ignore = ".non_val";
                    settngs.ignoreTitle = true;
                    window.opener.location.reload();
                    window.close();
                }
              $('#starttime').click(function () {
                  WdatePicker({ dateFmt: 'yyyy-MM-dd', onpicked: pickedFunc1 })
              });
             $('#BtnSubmit').click(function () {
                  if (valDate())
                      $('form').submit();
              });
               $('#pid').change(function () {
                  //debugger
                  var pid = $(this).val();
                  $.ajax({
                      type: "POST",
                      url: '@Url.Action("GetStatus", "Item") ',
                      data: { pid: pid },
                      cache: false,
                      success: function (ret) {
                          //debugger
                          var val = eval(ret)
                          $('#LI02 .editor-field').text(val.msg);
                          $('#status').val(val.msg);
                      }
                  });
               });
              //debugger
              var settngs = $.data($('form')[0], 'validator').settings;
              //              delete settings.rules.rate;
              //              delete settings.rules.comment; 
              $('#rate').addClass('non_val');
              $('#comment').addClass('non_val');
              settngs.ignore = ".non_val";
              settngs.ignoreTitle = true;
          });
          function pickedFunc1() {
              var dayofwk = $dp.cal.getP('w');
              if (dayofwk != '01')
                  alert('日期错误！只能选择星期一');
          }
          function valDate() {
              var date1 = new Date();
              date1.setFullYear($dp.$D('starttime').y, $dp.$D('starttime').M - 1, $dp.$D('starttime').d);
              var dayofwk1 = date1.getDay();
              if (dayofwk1 != 1) {
                  alert('日期选择错误！');
                  return false;
              }
              else {
                  return true;
              }
          }
    </script>
    @using (Html.BeginForm())
    {
       
        <div class="form">
            <div class="sitemap">
                编辑工时记录
            </div>
            <div class="body">
                <ul class="cur">
                    <li>
                        <div class="editor-label">
                            <label>
                                用户姓名</label>
                        </div>
                        <div class="editor-field">
                            @Html.HiddenFor(model => model.uid)
                            @Html.HiddenFor(model => model.submitter)
                            @Html.HiddenFor(model => model.account)
                            @Html.HiddenFor(model => model.submittime)
                            @Html.HiddenFor(model => model.status)
                            @Html.HiddenFor(model => model.role)
                            @Html.HiddenFor(model => model.ack_user)
                            @Html.HiddenFor(model => model.comment)
                            @Html.HiddenFor(model => model.rate)
                            @Html.HiddenFor(model => model.ack)
                            @Html.HiddenFor(model => model.ack_time)
                            @Html.HiddenFor(model => model.ack_type)
                            @Html.HiddenFor(model => model.role)
                            @Html.DisplayFor(model => model.account)
                            @Html.DisplayFor(model => model.Brower)
                        </div>
                    </li>
                    <li>
                        <div class="editor-label">
                            <label>
                                角色</label>
                        </div>
                        <div class="editor-field">
                            @Html.DisplayFor(model => model.role)
                        </div>
                    </li>
                    <li>
                        <div class="editor-label">
                            <label>
                                所属项目</label>
                        </div>
                        <div class="editor-field">
                            @Html.DropDownListFor(model => model.pid, (SelectList)ViewBag.pidSelectList, "---", new { @class = "Select" })
                            @{Html.ValidateFor(x => x.pid);}
                            @Html.ValidationMessageFor(model => model.pid)
                        </div>
                    </li>
                    <li id="LI02">
                        <div class="editor-label">
                            <label>
                                项目状态</label>
                        </div>
                        <div class="editor-field">
                            @Html.DisplayFor(model => model.status);
                        </div>
                    </li>
                    <li>
                        <div class="editor-label">
                            <label>
                                开始时间</label>
                        </div>
                        <div class="editor-field">
                            @Html.EditorFor(model => model.starttime)
                            @{Html.ValidateFor(x => x.starttime);}
                            @Html.ValidationMessageFor(model => model.starttime)
                        </div>
                    </li>
                    <li>
                        <div class="editor-label">
                            <label>
                                工作时长</label>
                        </div>
                        <div class="editor-field">
                            @Html.EditorFor(model => model.cost)小时
                            @{Html.ValidateFor(x => x.cost);}
                            @Html.ValidationMessageFor(model => model.cost)
                        </div>
                    </li>
                    <li>
                        <div class="editor-label">
                            <label>
                                事项</label>
                        </div>
                        <div class="editor-field">
                            @Html.TextAreaFor(model => model.title, new { @style = "width:350px", rows = "5", cols = "70" })
                            @{Html.ValidateFor(x => x.title);}
                            @Html.ValidationMessageFor(model => model.title)
                        </div>
                    </li>
                    <li>
                        <div class="editor-label">
                            <label>
                                确认状态</label>
                        </div>
                        <div class="editor-field">
                            @if (Model.ack != null)
                            {
                                @Html.DisplayFor(model => model.ack_type)
                            }
                            else
                            {
                                <span>未确认</span>
                            }
                        </div>
                    </li>
                    <li>
                        <div class="editor-label">
                            <label>
                                评价</label>
                        </div>
                        <div class="editor-field">
                            @Html.DisplayFor(model => model.rate)
                        </div>
                    </li>
                    <li>
                        <div class="editor-label">
                            <label>
                                备注</label>
                        </div>
                        <div class="editor-field">
                            @Html.DisplayFor(model => model.comment)
                        </div>
                    </li>
                    <li style="padding-left: 250px;">
                        <input id="BtnSubmit" type="button" value="保存" class="Button01" />
                    </li>
                </ul>
            </div>
        </div>
    }
    @Html.CommonnScript()
</body>
</html>
